<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	<script>
		//push unshift  pop  shift  splice() concat 	
	var arr=[10,20,'js','html','css'];
	
	for(var i=0;i<arr.length;i++){
		console.log(arr[i])
	}		
			
	for(var attr in arr){
		console.log(arr[attr])
	}		
	
	arr.forEach(function(el,index){
		console.log(el); //指数组的每一项
		console.log(index); //指下标
	})
	var arr1=[1,2,3,4];
	
	//返回的是一个新数组,不会改变原数组的值
	var newArr=arr1.map(function(el,index){
		 return el+1;
	})
	
	console.log(newArr)	
		console.log(arr1)
		
var goods=[
	   {
		   id:100,
		   name:'欧米伽',
		   price:102
	   },
	   {
	   		id:101,
	   		name:'浪琴',
	   		price:23
	   },
	   {
	   		id:200,
	   		name:'天王',
	   		price:633
	   }
]
	//返回符合条件的元素
	var item=goods.find(function(el,index){
		return el.id==200
	}) 
 	console.log(item);
	//返回符合元素的下标，如果查找不到返回-1
    var index=goods.findIndex(function(el,index){
		return el.id==300
	})
	console.log(index);
	//goods.splice(index,1);
	//console.log(goods);
	
	
	// function fun(a,b,c){
	// 	console.log(Array.isArray(arguments))
	// }
	//Array.isArray 判断是不是数组
	
	//fun(1,2,3);
	
	//Array.from :将类数组转化为数组
	var obj={
	     0:'html',
		 1:'css',
		 2:'js',
		length:3
	}
	
	console.log(Array.from(obj))
	
	function fun(a,b,c){
		console.log(Array.from(arguments))
	}
	
	fun(1,2,3)
	
	//var arr=[]; 
	
	//var arr1=new Array()
	
	// var arr1=new Array(3);
	// var arr2=new Array('3');
	// var arr3=new Array(2,5);
	
	
	var arr1=Array.of(3);
	var arr2=Array.of('3');
	var arr3=Array.of(2,5);
	console.log(arr1);
	console.log(arr2);
	console.log(arr3);
	
	
	
	
    </script>
	<div style="height: 1000px;"></div>	
	</body>
</html>
